//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "About.h"
#include "MainForm.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TfrmAbout *frmAbout;
//---------------------------------------------------------------------------
__fastcall TfrmAbout::TfrmAbout(TComponent* Owner)
	: TForm(Owner)
{
}
BOOL TfrmAbout::GetAppVersion(TCHAR *Version)
{
	  TCHAR                       sss[256];
	  DWORD                       dwDummy;  
	  unsigned   int         uiSize;  
	  GetModuleFileName(NULL,   sss,   sizeof(sss));  
   
	  DWORD       dwSize=GetFileVersionInfoSize(sss,   &dwDummy);
	  char         *lpData=new   char[dwSize];  
	  GetFileVersionInfo(sss,   0,   dwSize,   lpData);  
   
	  VS_FIXEDFILEINFO         *lpffi;  
	  VerQueryValue(lpData,   TEXT("\\"),   (LPVOID   *)   &lpffi,   &uiSize);  
	  wsprintf(Version,  
								TEXT("%d.%d.%d.%d"),  
								HIWORD(lpffi->dwFileVersionMS),  
								LOWORD(lpffi->dwFileVersionMS),  
								HIWORD(lpffi->dwFileVersionLS),  
								LOWORD(lpffi->dwFileVersionLS));  
	  delete   []lpData;  
	  return   TRUE;  
}
//---------------------------------------------------------------------------
void __fastcall TfrmAbout::Button1Click(TObject *Sender)
{
Close();	
}
//---------------------------------------------------------------------------
void __fastcall TfrmAbout::FormClose(TObject *Sender, TCloseAction &Action)
{
Action = caFree;	
}
//---------------------------------------------------------------------------
void __fastcall TfrmAbout::lblSupportMouseDown(TObject *Sender, TMouseButton Button,
      TShiftState Shift, int X, int Y)
{
AnsiString Address = "mailto:"+((TLabel*)Sender)->Caption;
ShellExecute(0,NULL,Address.c_str(),NULL,NULL,SW_SHOWNORMAL);
}
//---------------------------------------------------------------------------
void __fastcall TfrmAbout::lblWebsiteMouseDown(TObject *Sender,
      TMouseButton Button, TShiftState Shift, int X, int Y)
{
AnsiString Address = "http://wanguangming.com";
ShellExecute(0,NULL,Address.c_str(),NULL,NULL,SW_SHOWNORMAL);
}
//---------------------------------------------------------------------------
void __fastcall TfrmAbout::lblSalesMouseDown(TObject *Sender,
      TMouseButton Button, TShiftState Shift, int X, int Y)
{
AnsiString Address = "mailto:"+((TLabel*)Sender)->Caption;
ShellExecute(0,NULL,Address.c_str(),NULL,NULL,SW_SHOWNORMAL);	
}
//---------------------------------------------------------------------------
void __fastcall TfrmAbout::FormCreate(TObject *Sender)
{
	TCHAR mainAppVersion[255];
	bool ir = GetAppVersion(mainAppVersion);
	if(ir)
	{
		lblMainAppVersion->Caption = mainAppVersion;
    }
	std::string ver = frmmain->getDllVersion();
	Panel2->Caption = ver.c_str();

}
//---------------------------------------------------------------------------

